The root cause of software security lies in the source code developed by software developers, but with the continues increasing size and complexity of software, it is costly and difficult to perform vulnerability detection only manually, while the existing code analysis tools have high false positive rate and false negative rate. Therefore, an automatic vulnerability detection method based on Relational Graph Convolution Network (RGCN) was proposed to further improve the accuracy of vulnerability detection. Firstly, the program source code was transformed into CPG containing syntax and semantic information. Then, representation learning was performed to the graph structure by RGCN. Finally, a neural network model was trained to predict the vulnerabilities in the program source code. To verify the effectiveness of the proposed method, an experimental validation was conducted on the real-world software vulnerability samples, and the results show that the recall and F1-measure of vulnerability detection results of the proposed method reach 80.27% and 63.78% respectively. Compared with Flawfinder, VulDeepecker and similar method based on Graph Convolution Network (GCN), the proposed method has the F1-measure increased by 182%, 12% and 55% respectively. It can be seen that the proposed method can effectively improve the vulnerability detection capability.